﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mesoBoard.Data.Repositories
{
    public class RepositoriesWrapper : IRepositoriesWrapper
    {
        private IConfigRepository _Configs;
        private IUserRepository _Users;
        private ICategoryRepository _Categories;
        private IForumRepository _Forums;
        private IPostRepository _Posts;
        private IThreadRepository _Threads;
        private IPollRepository _Polls;
        private IAttachmentRepository _Attachments;
        private IFileTypeRepository _FileTypes;
        private IRoleRepository _Roles;
        private IPermissionRepository _Permissions;
        private IThemeRepository _Themes;
        private IOnlineUserRepository _OnlineUsers;
        private IBBCodeRepository _BBCodes;
        private IMessageRepository _Messages;
        private ISmileyRepository _Smilies;
        private IPluginConfigRepository _PluginConfigs;
        private IReportedPostRepository _ReportedPosts;
        private IRankRepository _Ranks;
        private IPluginsRepository _Plugins;

        public IPluginsRepository Plugins
        {
            get
            {
                if (_Plugins == null)
                    _Plugins = new PluginsRepository(this.db);

                return _Plugins;
            }
        }

        public IConfigRepository Configs
        {
            get
            {
                if (_Configs == null)
                    _Configs = new ConfigRepository(this.db);

                return _Configs;
            }
        }
        public IUserRepository Users
        {
            get
            {
                if (_Users == null)
                    _Users = new UserRepository(this.db);

                return _Users;
            }
        }
        public ICategoryRepository Categories
        {
            get
            {
                if (_Categories == null)
                    _Categories = new CategoryRepository(this.db);

                return _Categories;
            }
        }
        public IForumRepository Forums
        {
            get
            {
                if (_Forums == null)
                    _Forums = new ForumRepository(this.db);

                return _Forums;
            }
        }
        public IPostRepository Posts
        {
            get
            {
                if (_Posts == null)
                    _Posts = new PostRepository(this.db);

                return _Posts;
            }
        }
        public IThreadRepository Threads
        {
            get
            {
                if (_Threads == null)
                    _Threads = new ThreadRepository(this.db);

                return _Threads;
            }
        }
        public IPollRepository Polls
        {
            get
            {
                if (_Polls == null)
                    _Polls = new PollRepository(this.db);

                return _Polls;
            }
        }
        public IAttachmentRepository Attachments
        {
            get
            {
                if (_Attachments == null)
                    _Attachments = new AttachmentRepository(this.db);

                return _Attachments;
            }
        }
        public IFileTypeRepository FileTypes
        {
            get
            {
                if (_FileTypes == null)
                    _FileTypes = new FileTypeRepository(this.db);

                return _FileTypes;
            }
        }
        public IRoleRepository Roles
        {
            get
            {
                if (_Roles == null)
                    _Roles = new RoleRepository(this.db);

                return _Roles;
            }
        }
        public IPermissionRepository Permissions
        {
            get
            {
                if (_Permissions == null)
                    _Permissions = new PermissionRepository(this.db);

                return _Permissions;
            }
        }
        public IThemeRepository Themes
        {
            get
            {
                if (_Themes == null)
                    _Themes = new ThemeRepository(this.db);

                return _Themes;
            }
        }
        public IOnlineUserRepository OnlineUsers
        {
            get
            {
                if (_OnlineUsers == null)
                    _OnlineUsers = new OnlineUserRepository(this.db);

                return _OnlineUsers;
            }
        }
        public IBBCodeRepository BBCodes
        {
            get
            {
                if (_BBCodes == null)
                    _BBCodes = new BBCodeRepository(this.db);

                return _BBCodes;
            }
        }
        public IMessageRepository Messages
        {
            get
            {
                if (_Messages == null)
                    _Messages = new MessageRepository(this.db);

                return _Messages;
            }
        }
        public ISmileyRepository Smilies
        {
            get
            {
                if (_Smilies == null)
                    _Smilies = new SmileyRepository(this.db);

                return _Smilies;
            }
        }
        public IPluginConfigRepository PluginConfigs
        {
            get
            {
                if (_PluginConfigs == null)
                    _PluginConfigs = new PluginConfigRepository(this.db);

                return _PluginConfigs;
            }
        }
        public IReportedPostRepository ReportedPosts
        {
            get
            {
                if (_ReportedPosts == null)
                    _ReportedPosts = new ReportedPostRepository(this.db);

                return _ReportedPosts;
            }
        }
        public IRankRepository Ranks
        {
            get
            {
                if (_Ranks == null)
                    _Ranks = new RankRepository(this.db);

                return _Ranks;
            }
        }

        private mbEntities db;

        public RepositoriesWrapper(mbEntities dataContext)
        {
            this.db = dataContext;
        }
    }
}
